<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/jquery-3.5.1.min.js"></script>
</head>
<body>
    <input type="text" >
    <button>发射</button>
    <script>
        // 防抖
        let tiems = null
        $('button').click(function(){
            clearTimeout(tiems)

           tiems = setTimeout(i=>{
                console.log(1234);

            },1000)
        })
        // 节流 节约流量  一段时间内执行一次
        let isvalue = false
        $('input').keyup(function(e) {
            // console.log($(this).val());
            if (isvalue) {
                console.log($(this).val());
                isvalue = false    
            }
            setTimeout(()=>{
                isvalue = true    
            },1000)
            
          
           
            
        })

    </script>
</body>
</html>